from flask import Flask, render_template, request, Response, make_response

import socket
import os

app = Flask(__name__)


@app.route('/person/<name>', methods=["GET", "POST"])
def query_name(name):
    return "查询人的名字是：" + name


@app.route('/result', methods=['POST', 'GET'])
def result():
    param = request.form
    result1 = param['name'] + " " + param['address']
    rep = Response(result1)
    rep.headers['content-type'] = 'application/json;charset=utf-8'
    return rep
    # return render_template("result.html", result=result1)


@app.route('/page')
def page():
    resp = make_response(render_template("result.html"))
    resp.headers['content-type'] = 'text/html;charset=utf-8'
    return resp


if __name__ == "__main__":
    app.run(host='127.0.0.1', port=8082)
